package cn.sycoder.mapper;

import cn.sycoder.entity.RoleMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 杨润发
 * @since 2024-10-22
 */
@Repository
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {

    // 自定义查询 sql
    @Select("select * from role_menu where role_id = #{roleId}")
    List<RoleMenu> roleMenus(Long roleId);


    // 自定义删除sql
    @Delete("delete from role_menu where role_id = #{roleId}")
    int deleteByRoleId(Long roleId);


    // 自定义查询 menu_id
    @Select("select menu_id from role_menu where role_id = #{roleId}")
    List<Long> selectMenuId(Long roleId);
}
